/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: '微软雅黑', 'Microsoft YaHei', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 头部导航 */
.header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
}

.nav-tabs {
    display: flex;
    gap: 10px;
}

.nav-tab {
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    font-size: 14px;
}

.nav-tab:hover {
    background-color: #f0f0f0;
}

.nav-tab.active {
    background-color: #3498db;
    color: white;
}

/* 主要内容区域 */
.tab-content {
    display: none;
    min-height: calc(100vh - 60px);
}

.tab-content.active {
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.section {
    background: white;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section h2 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 18px;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #7f8c8d;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #229954;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #c0392b;
}

/* 主题管理页面 */
.topic-input-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.input-group {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 600px;
}

.input-group input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.divider {
    color: #7f8c8d;
    font-weight: bold;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.topic-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.topic-card:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.topic-card.selected {
    border-color: #3498db;
    background-color: #e3f2fd;
}

.topic-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #2c3e50;
}

.topic-meta {
    font-size: 12px;
    color: #7f8c8d;
}

.loading-placeholder {
    text-align: center;
    color: #7f8c8d;
    padding: 40px;
    font-style: italic;
}

/* 内容生成页面 */
.generate-layout {
    display: flex;
    height: calc(100vh - 60px);
}

.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 20px;
    overflow-y: auto;
}

.sidebar h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.param-group {
    margin-bottom: 20px;
}

.param-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.param-group input,
.param-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.param-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.current-topic {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    font-style: italic;
    color: #6c757d;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.content-header h3 {
    color: #2c3e50;
}

.content-actions {
    display: flex;
    gap: 10px;
}

#article-editor {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.editor-placeholder {
    text-align: center;
    color: #7f8c8d;
    padding: 100px 20px;
    font-style: italic;
}

/* Quill编辑器样式调整 */
.ql-editor {
    font-family: '微软雅黑', 'Microsoft YaHei', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.8;
}

.ql-editor h1, .ql-editor h2, .ql-editor h3 {
    color: #2c3e50;
    margin: 20px 0 10px 0;
}

.ql-editor pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
}

.ql-editor code {
    background-color: #f1f3f4;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* 状态栏 */
.status-bar {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.status-text {
    margin-bottom: 10px;
    color: #6c757d;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background-color: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #3498db;
    width: 0%;
    transition: width 0.3s;
    animation: progress-animation 2s infinite;
}

@keyframes progress-animation {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* 历史记录页面 */
.history-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.history-controls input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.history-item:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.history-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #2c3e50;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #7f8c8d;
}

.history-actions {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.history-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* 设置页面 */
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-item label {
    font-weight: bold;
    color: #555;
}

.setting-item input,
.setting-item select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.setting-item input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.settings-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    justify-content: center;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .generate-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .topics-grid {
        grid-template-columns: 1fr;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .content-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .content-actions {
        justify-content: center;
    }
}

/* 深色主题 */
body.dark-theme {
    background-color: #2c3e50;
    color: #ecf0f1;
}

.dark-theme .header {
    background: #34495e;
    border-bottom-color: #4a5f7a;
}

.dark-theme .section {
    background: #34495e;
    color: #ecf0f1;
}

.dark-theme .sidebar {
    background: #34495e;
    border-right-color: #4a5f7a;
}

.dark-theme .main-content {
    background: #34495e;
}

.dark-theme .content-header {
    border-bottom-color: #4a5f7a;
}

.dark-theme input,
.dark-theme select {
    background: #2c3e50;
    color: #ecf0f1;
    border-color: #4a5f7a;
}

.dark-theme .topic-card,
.dark-theme .history-item {
    background: #2c3e50;
    border-color: #4a5f7a;
    color: #ecf0f1;
}

.dark-theme .modal-content {
    background: #34495e;
    color: #ecf0f1;
}